<template>
    <el-table :data="tableData" fit border size="mini">
        <el-table-column type="index" label="序号" width="80"></el-table-column>
        <el-table-column prop="name" label="商圈名称"></el-table-column>
        <el-table-column label="操作" width="150">
            <template slot-scope="scope">
                <el-button type="text" size="small" @click="addCityArea('edit',scope.row)">修改</el-button>
                <el-button type="text" size="small" @click="closeDeal(scope.row)">删除</el-button>
            </template>
        </el-table-column>
    </el-table>
</template>
<script>
import { request } from "../../assets/request.js";
export default {
    data(){
        return{
            tableData: []
        }
    },
    created(){
        let that = this;
        this.$root.$on("handleNodeClick", arr => {
            console.log(arr)
            that.tableData=arr
        });
    },
    methods:{
        closeDeal(row){
            let that=this
            request.delAlert({
                name:'删除该商圈',
                that,
                fn(obj){
                    let url='city/area/'+row.id+'?greenToken='+request.greenToken
                    request.ajaxDel({
                        url,
                        that,
                        fn(res){
                            that.$message(obj)
                        }
                    })
                }
            })
        },
        addCityArea(type,row){
            this.$root.$emit("addCityArea",type,row)
        }
    }
}
</script>
<style lang="less" scoped>

</style>
